package me.yricky.cov_spectrum.model.utils

import com.fasterxml.jackson.databind.DeserializationFeature
import com.fasterxml.jackson.databind.ObjectMapper

private val objectMapper = ObjectMapper().apply {
    configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
}

fun <T> String.toObject(clazz: Class<T>):T = objectMapper.readValue(this,clazz)

fun <T> T.toJson():String = objectMapper.writeValueAsString(this)